﻿using System;
using System.Collections.Generic;
using System.Drawing;
using NeuralNetwork.OutputTypes;


namespace NeuralNetwork.Training
{
    public class Test
    {
        public List<double> input = null;
        public List<Output> outputs = null;

        public Test()
        { 
        
        }

        public Test(List<double> input, List<Output> outputs)
        {
            this.input = input;
            this.outputs = outputs;
        }      
    }

    public class ImageTest : Test
    {
        public ImageTest(Bitmap input, List<Output> outputs)
        {
            List<double> bmpAsList = new List<double>(input.Width * input.Height);
            
            if (input != null)
            {
                double value = 0;
                double d = (double)(255 * 255 * 255 + 255 * 255 + 255);
                for(int y = 0; y < input.Height; y++)
                    for(int x = 0; x < input.Width; x++)
                    {
                        Color c = input.GetPixel(x, y);
                        value = Convert.ToDouble((c.R * 255 * 255 + c.G * 255 + c.B)/d);
                        bmpAsList.Add(value);
                    }
            }

            this.input = bmpAsList;
            this.outputs = outputs;
        }
    }

    public class LearningSet
    {
        public Network network = null;
        public List<Test> tests = null;

        public LearningSet()
        { 
        
        }

        public LearningSet(Network network, List<Test> tests)
        {
            this.network = network;
            this.tests = tests;
        }      
    }
}
